#include "../procinfo.h"

uint64_t s_cycle_times = 9000000000;

int32_t main( int32_t argc, char * argv[] )
{
	pid_t pid = getpid();
	ProcInfo proc_statics( pid );

    fprintf( stderr, "cpu count(%d) online cpu count(%d)\n", ProcInfo::get_cpu_count(),
        ProcInfo::get_online_cpu_count() );

	while( s_cycle_times-- )
	{
		if( 0 == s_cycle_times % 50000000 )
		{
			proc_statics.calc_cpu_usage();
			proc_statics.calc_mem_usage();
			fprintf( stderr, "cpu usage(%f) sys_time(%f) user_time(%f)\n",
				proc_statics.get_cputime_rate(), proc_statics.get_stime_rate(), proc_statics.get_utime_rate() );
			fprintf( stderr, "vm_size(%d) rss_size(%d) stack_size(%d)\n",
				proc_statics.get_proc_vmsize(), proc_statics.get_proc_rsssize(), proc_statics.get_proc_stksize() );
		}
		//fprintf( stderr, "cycle times = %lu\n", s_cycle_times );
	}
	struct timeval tv;
	gettimeofday( &tv, NULL );

	fprintf( stderr, "cpu usage(%f) sys_time(%f) user_tim(%f)\n",
		proc_statics.get_cputime_rate(), proc_statics.get_stime_rate(), proc_statics.get_utime_rate() );
	return 0;
}


